//添加机舱点位
const jclist = [
  {
    name: '华大时空中心楼顶',
    lon: 114.310202,
    lat: 22.605884
  },
  {
    name: '大梅沙大草坪西侧临时起降点',
    lon: 114.301248,
    lat: 22.593783
  },
  {
    name: '恩上水库',
    lon: 114.229747,
    lat: 22.571348
  },
  {
    name: '山海四季城',
    lon: 114.24948,
    lat: 22.595039
  },
  {
    name: '壹海城机巢',
    lon: 114.233683,
    lat: 22.557185
  },
  {
    name: '中英街机巢',
    lon: 114.230637,
    lat: 22.547663
  }
]
export async function addJc(data) {
  if (!data) data = jclist
  const markerArr = []
  data.forEach((item, index) => {
    let o = {
      id: `jc` + index, //maker唯一标识
      groupId: 'jc',
      coordinate: [Number(item.lon), Number(item.lat)], //坐标位置
      coordinateType: 1, //坐标系类型
      imagePath: window.origin + '/poi/机舱.png',
      anchors: [-25, 50],
      imageSize: [50, 50],
      fixedSize: true,
      range: [0, 20000000], //标签的可见范围 [Min,Max]
      autoHidePopupWindow: true,
      userData: JSON.stringify(item),
      displayMode: 2, //显示模式
      // priority: 0, //避让优先级
      autoHeight: true,
      occlusionCull: false
    }
    markerArr.push(o)
  })
  await __g.marker.add(markerArr)
}

export async function clear() {
  __g.marker.deleteByGroup('jc')
}
